<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
Class Index extends MY_Controller
{
    public function __construct()
    {
        parent::__construct();
        $this->data['controller'] = 'index';
        $this->load->model('Mindex');
    }
    
	public function index()
	{
		die('');
	}
	
	public function getRestaurantLabel()
    {
        $time = $this->getParamString('time');
        die(json_encode($this->Mindex->getRestaurantLabelDb($time)));
    }
    
    public function getStaticData()
    {
        $time = $this->getParamString('time');
        die(json_encode($this->Mindex->getStaticDataDb($time)));
    }
    
    public function getProvince()
    {
        die(json_encode($this->Mindex->getProvinceDb()));
    }
    
    public function getRestaurantDetail()
    {
        $restaurant_id = $this->getParamInt('restaurant_id');
        die(json_encode($this->Mindex->getRestaurantDetailDb($restaurant_id)));
    }
	
	public function getincentivedetail(){
		$incentive_id = $this->getParamInt('incentive_id');
		die(json_encode($this->Mindex->getIncentiveDetail($incentive_id)));
	}
	
	
	public function getnearrestaurant()
    {
		$restaurantid = $this->getParamInt('restaurantid');
		$locationid = $this->getParamInt('locationid');		
        die(json_encode($this->Mindex->getNearRestaurant($restaurantid,$locationid)));
    }
    
    public function getToken()
    {
        $user_id = $this->getParamInt('user_id');
        $key = $this->getParamString('key');
        $type = $this->getParamString('type');
        die(json_encode($this->Mindex->getKeyDb($user_id ? $user_id : 0, $key, $type)));
    }
    
    public function pushByToken()
    {
        $message = $this->getParamString('message');
        $key = $this->getParamString('key');
        $type = $this->getParamString('type');
        die(json_encode($this->Mindex->pushByTokenDb($message, $key, $type)));
    }
}
